<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/quocha/lib/DonHang.php';
$donhangOb = new DonHang();
$donhang = $donhangOb->layChiTietDonHang($_GET['id']);
?>
<div class="grid_10">
    <div class="box round first grid">
        <h2>
            Chi tiết giỏ hàng</h2>
        <div class="block">

            <table class="data display datatable" id="example">

                <thead>
                    <tr>
                        <th>STT</th>
                        <th>ID_Sản phẩm</th>
                        <th>Sản phẩm</th>
                        <th>Số lượng</th>
                        <th>Đơn giá</th>
                        <th>Thành tiền</th>
                    </tr>
                </thead>
                <?php
                    $i = 0;
                    $thanhtien = 0;
                    $tongcong = 0;
                    ?>
                <tbody>
                <?php while ($dh = mysql_fetch_assoc($donhang)): ?>
                        <?php $SP = $donhangOb->layTenSanPham($dh['sanpham_id']) ?>
                        <?php $tongcong += $thanhtien ?>
                        <tr class="odd gradeX">
                            <td ><?php echo++$i; ?></td>
                                <td><?php echo $dh['sanpham_id']; ?></td>
                                <td><?php echo $SP['ten'] ?></td>
                                <td><?php echo $dh['soluong']; ?></td>
                                <td><?php echo number_format($dh['dongiahientai']); ?></td>
                                <td><?php echo number_format($thanhtien = $dh['soluong'] * $dh['dongiahientai']); ?></td>
                        </tr>
                        <?php endwhile; ?>
                </tbody>
                
              
            </table>
            <div><b>Tông tiền cần phải thanh toán: <?php echo number_format($tongcong)?> VNĐ</b></div>
                 